<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<div id="dialog-form" title="设置">
	<form id="myForm" action="${pageContext.request.contextPath }/pages/user_edit.do" method="post">
		<fieldset>
			<input type="hidden" id="user_id" name="user.id" value="${user.id}" />
			<label class="f_label" for="email">
				邮箱：
			</label>
			<input type="text" disabled="disabled" name="user.umail" value="${user.uemail}" class="disabled_input text" />
			<br>
			<label class="f_label" for="name">
				昵称：
			</label>
			<input type="text" name="nick" value="${user.nick}" class="text" />
			<br>
			<label class="f_label" for="password">
				旧密码：
			</label>
			<input type="password" id="password" name="oldPasswd" class="text" onblur="check(this.value);"/>
			
			<br>
			<label class="f_label" for="password">
				新密码：
			</label>
			<input type="password" id="newPasswd" disabled="disabled" name="newPasswd" class="disabled_input text" />
		</fieldset>
	</form>
</div>
<script type="text/javascript">
	
	function check(passwd) {
		$("#PWD").remove();
		if("" != passwd) {
			$.post("${pageContext.request.contextPath }/ajax/user_check.do", { "user.id": $("#user_id").val(), "user.passwd": passwd },function(data) {
     			if("true" == data.flag) {
     				$("#newPasswd").removeAttr("disabled");
     				$("#newPasswd").removeClass("disabled_input");
     				$("<img id='PWD' class='icons' src='images/icons/icon_success.png' alt='valid'>").insertAfter("#password");
     			} else {
     				$("<img id='PWD' class='icons' src='images/icons/icon_error.png' alt='invalid'>").insertAfter("#password");
     				$("#newPasswd").attr("disabled","disabled");
					$("#newPasswd").addClass("disabled_input");
					$("#newPasswd").val("");
     			}
   			}, "json");
		}
	}
</script>